<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/messages.jsp"%>
<%@ include file="/commons/commonEdit.jsp" %>
<%@ include file="/commons/validation.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${key.charge_adjust_title}</title>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<style type="text/css">
.inputHidden {
BORDER-RIGHT: medium none; BORDER-TOP: medium none;  BORDER-LEFT: medium none;  COLOR: #000000; BORDER-BOTTOM: medium none; FONT-FAMILY: "宋体";  TEXT-DECORATION: none
}
</style>
<script>
function next(url){
	window.location.href = url;
}
function calculate(thiz){
	if(thiz.value.length>0 && isNaN(thiz.value) == false)
		{
			var result = parseFloat(${reliefTran.curTransPrice})+parseFloat(thiz.value);
			if(result >=0 )
				document.getElementById('reliefBalance').value=ForDight(result,2);
			else
			{
				FailureAlert('${key.charge_adjust_tip}');
				document.getElementById('debit').value="";
			}
		}
}
function   ForDight(Dight,How)
{
     Dight = Math.round(Dight*Math.pow(10,How))/Math.pow(10,How);
     return Dight;
}
function   round(result)   {
  var member = result;
  member.toString().replace(/^(\d+\.\d{2})\d*$/,"$1");
  return   member;
}

function ajaxSubmit(){
	var isTrue=$('adjustForm').fireEvent("onSubmit");
    if(isTrue){
        var url = "${ctx}/charge_cashieringAction.do?method=addAdjust";
        var param = Form.serialize('adjustForm');
        new Ajax.Request(url,{method: 'post',parameters :param ,onSuccess : showResponse});
	}
}
function showResponse(response){
	if(response.responseText == "true" ){
	    var obj = findFrame("connTabPanel");
	    windowClose();
	    obj.refresh();
    }
    else
       ajaxSubmitException(response.responseText);
}
</script>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2" class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle"> <span class="window_head_intext">${key.charge_adjust_title}</span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td border="0" cellspacing="0" cellpadding="0" class="content"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="aux_outtable_color">
         <form name="adjustForm" method="post" action="${ctx}/charge_cashieringAction.do?method=addAdjust" class="required-validate">
         <input type="hidden" name="transactionId" value="${transactionId}">
         <input type="hidden" name="businessId" value="${reliefTran.businessId}">
         <input type="hidden" name="houseId" value="${reliefTran.houseId}">
         <input type="hidden" name="subAccountId" value="${reliefTran.subAccountId}">
         <input type="hidden" name="periodId" value="${reliefTran.periodId}">
         <input type="hidden" name="period" value="${reliefTran.period}">
         <input type="hidden" name="accountHouseId" value="${accountHouseId}">
         <input type="hidden" name="rootTransId" value="${reliefTran.rootTransId}">
         <input type="hidden" name="transName" value="${reliefTran.transName}">
         <input type="hidden" name="statuz" value="${statuz}">
         <input type="hidden" name="masterDebit" value="${reliefTran.principalTrans.debit}">
         <input type="hidden" name="haveReliefPrice" value="${reliefTran.haveReliefPrice}">
         <input type="hidden" name="haveAdjustPrice" value="${reliefTran.haveAdjustPrice}">
         <input type="hidden" name="curTransPrice" value="${reliefTran.curTransPrice}">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
            <tr>
              <td valign="top" class="aux_intable_td1">${key.charge_adjust_transName}：</td>
              <td class="aux_intable_td2">${reliefTran.transName}</td>
            </tr>
            <tr>
              <td valign="top" class="aux_intable_td1">${key.charge_adjust_period}：</td>
              <td class="aux_intable_td2">${reliefTran.period}</td>
            </tr>
            <tr>
              <td valign="top" class="aux_intable_td1">${key.charge_adjust_masterDebit}：</td>
              <td class="aux_intable_td2"><fmt:formatNumber pattern='###,##0.00' value='${reliefTran.principalTrans.debit}'/>${key.yuan}</td>
            </tr>
            <tr>
              <td valign="top" class="aux_intable_td1">${key.charge_adjust_haveDeratePrice}：</td>
              <td class="aux_intable_td2"><fmt:formatNumber pattern='###,##0.00' value='${reliefTran.haveReliefPrice}'/>${key.yuan}</td>
            </tr>
            <tr>
              <td valign="top" class="aux_intable_td1">${key.charge_adjust_haveAdjustPrice}：</td>
              <td class="aux_intable_td2"><fmt:formatNumber pattern='###,##0.00' value='${reliefTran.haveAdjustPrice}'/>${key.yuan}</td>
            </tr>
            <tr>
              <td valign="top" class="aux_intable_td1">${key.charge_adjust_curTransPrice}：</td>
              <td class="aux_intable_td2"><fmt:formatNumber pattern='###,##0.00' value='${reliefTran.curTransPrice}'/>${key.yuan}</td>
            </tr>
            <tr>
              <td valign="top" class="aux_intable_td1">${key.charge_adjust_debit}：</td>
              <td class="aux_intable_require">
                <input name="debit" type="text" class="required float-un-zero integer-decimal-range-18-2" value=""  onblur="calculate(this);" afterInsert="debitTip" maxlength="18">  ${key.yuan}   <span id="debitTip"></span>        </td>
            </tr>
            <tr>
              <td valign="top" class="aux_intable_td1">${key.charge_adjust_reliefBalance}：</td>
              <td class="aux_intable_td2"><input name="reliefBalance" type="text" class="inputHidden" readonly="true" />${key.yuan}</td>
            </tr>
            <tr>
              <td valign="top" class="aux_intable_td1">${key.charge_adjust_remark}：</td>
              <td class="aux_intable_require_more">
                <textarea name="remark" cols="16" rows="3" class="required max-length-350"></textarea>                </td>
            </tr>

        </table>
        </form>
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>

    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_61"></td>
              <td class="buttonOffMiddle" id="btn1_62" onClick="ajaxSubmit();" onMouseOver="btn_change_over(6)" onMouseOut="btn_change_out(6)" onBlur="btn_change(6)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom">${key.save}</td>
              <td class="buttonOffRight" id="btn1_63"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_71"></td>
              <td class="buttonOffMiddle" id="btn1_72" onClick="windowClose();" onMouseOver="btn_change_over(7)" onMouseOut="btn_change_out(7)" onBlur="btn_change(7)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom">${key.close}</td>
              <td class="buttonOffRight" id="btn1_73"></td>
            </tr>
        </table></td>
      </tr>
    </table>
    <p>&nbsp;</p></td>
  </tr>
</table>
</body>
</html>